//
//  AppDelegate.m
//  Nidalee
//
//  Created by 李康 on 2020/11/30.
//  Copyright © 2020 李康. All rights reserved.
//

#import "AppDelegate.h"
#import "MyMainViewController.h"
#import "HomePageViewController.h"
#import "MarketMainViewController.h"

#import "LoginViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    UIWindow *myWindow = [[UIWindow alloc] init];
    self.window = myWindow;
    myWindow.backgroundColor = [UIColor whiteColor];
    UITabBarController *tabbarViewController = [[UITabBarController alloc] init];
    tabbarViewController.viewControllers = [self createTabBarVirew];
    tabbarViewController.tabBar.tintColor = [UIColor systemOrangeColor];
    
    myWindow.rootViewController = tabbarViewController;
    
    [myWindow makeKeyAndVisible];
    
    
    return YES;
}

- (NSArray *)createTabBarVirew{
    
    NSMutableArray* array = [[NSMutableArray alloc]init];
    
    HomePageViewController *vc1 = [[HomePageViewController alloc]init];
    UINavigationController *homeVCnav = [[UINavigationController alloc]initWithRootViewController:vc1];
    homeVCnav.tabBarItem.title = @"首页";
    homeVCnav.tabBarItem.image = [[UIImage imageNamed:@"homeIcon1_S"] imageWithRenderingMode:UIImageRenderingModeAutomatic];
    homeVCnav.tabBarItem.selectedImage = [[UIImage imageNamed:@"homeIcon1_NS"] imageWithRenderingMode:UIImageRenderingModeAutomatic];
    [homeVCnav.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor orangeColor]} forState:UIControlStateSelected];
    [array addObject:homeVCnav];
    

    MarketMainViewController *vc2 = [[MarketMainViewController alloc]init];
    UINavigationController *vcNvc2 = [[UINavigationController alloc]initWithRootViewController:vc2];
    vcNvc2.tabBarItem.title = @"行情";
    vcNvc2.tabBarItem.image = [[UIImage imageNamed:@"homeIcon2_S"] imageWithRenderingMode:UIImageRenderingModeAutomatic];
    vcNvc2.tabBarItem.selectedImage = [[UIImage imageNamed:@"homeIcon2_NS"] imageWithRenderingMode:UIImageRenderingModeAutomatic];
    [vcNvc2.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor orangeColor]} forState:UIControlStateSelected];
    [array addObject:vcNvc2];
    
    
    MyMainViewController *vc3 = [[MyMainViewController alloc]init];
    UINavigationController *vcNvc3 = [[UINavigationController alloc]initWithRootViewController:vc3];
    vcNvc3.tabBarItem.title = @"我的";
    vcNvc3.tabBarItem.image = [[UIImage imageNamed:@"homeIcon3_S"] imageWithRenderingMode:UIImageRenderingModeAutomatic];
    vcNvc3.tabBarItem.selectedImage = [[UIImage imageNamed:@"homeIcon3_NS"] imageWithRenderingMode:UIImageRenderingModeAutomatic];
    [vcNvc3.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor orangeColor]} forState:UIControlStateSelected];
    [array addObject:vcNvc3];
    
    return array;
}


@end
